package com.neusoft.student.service.impl;

import com.neusoft.student.dao.StudentDao;
import com.neusoft.student.dao.impl.StudentDaoImpl;
import com.neusoft.student.model.Student;
import com.neusoft.student.service.StudentService;

import java.util.List;

/**
 * @Author: duan
 * @Date: Create in 10:06 2020/10/21
 */
public class StudentServiceImpl implements StudentService {
    private StudentDao studentDao = new StudentDaoImpl();

    @Override
    public Student login(String account, String password) {
//        return null;
        return studentDao.login(account, password);
    }

    @Override
    public List<Student> queryList(String search) {
        if (search != null && search.trim().length() != 0) {
            //如果有搜索条件
            return studentDao.queryList(search);
        } else {
            return studentDao.queryList();
        }
    }

    @Override
    public List<Student> queryListByPage(int offset, int limit) {
        return studentDao.queryListByPage(offset, limit);
    }

    @Override
    public int getCount() {
        return studentDao.getCount();
    }

    @Override
    public boolean insert(Student bean) {
        System.out.println("StudentServiceImpl:::insert");
        return studentDao.insert(bean);
    }

    @Override
    public boolean update(Student bean, Integer id) {
        return studentDao.update(bean, id);
    }

    @Override
    public boolean delete(Integer id) {
        return studentDao.delete(id);
    }

    @Override
    public Student getById(Integer id) {
        return studentDao.getById(id);
    }
}
